package com.gitee.cirnochat.login.model.vo.resp;

import com.gitee.cirnochat.login.model.entity.LoginDevice;
import com.gitee.cirnochat.login.model.enums.DeviceType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 登陆设备
 * @author FlanChan
 */
@Schema(description = "登录设备视图对象")
@Data
@NoArgsConstructor
public class LoginDeviceVo implements Serializable {
    /**
     * 主键ID
     */
    @Schema(description = "登陆历史ID",example = "1141241124214")
    private Long id;
    /**
     * 设备ID
     */
    @Schema(description = "设备ID", example = "device-1234567890")
    private String deviceId;

    /**
     * 设备名称
     */
    @Schema(description = "设备名称", example = "小米手机 12 Pro")
    private String deviceName;

    /**
     * 设备类型
     */
    @Schema(description = "设备类型", example = "PC, Mobile, Tablet")
    private DeviceType deviceType;

    /**
     * IP地址
     */
    @Schema(description = "IP地址",example = "113.123.12.31")
    private String ipAddress;

    /**
     * IP地址描述
     */
    @Schema(description = "IP地址描述",example = "中国|广东省|广州市")
    private String ipDescription;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间", example = "2024-01-01T12:00:00")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间,当设备再次登陆时更新", example = "2024-01-01T12:00:00")
    private LocalDateTime updateTime;


    public LoginDeviceVo (LoginDevice loginDevice) {
        BeanUtils.copyProperties(loginDevice, this);
    }

    private static final long serialVersionUID = 1L;
}